package sai.mysql;


import java.sql.*;
import java.io.*;

public class DriverLoading {

    PreparedStatement prepare;
    Connection connection;
    Statement state;

    public DriverLoading() throws SQLException, Exception {
        Class.forName("com.mysql.jdbc.Driver");
        connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/hcs", "root", null);
        System.out.println("connection succesful. .");
    }

    public PreparedStatement getPreparedStatement(String str) throws SQLException {
        prepare = connection.prepareStatement(str);
        return prepare;
    }

    public Statement getStatement() throws SQLException {
        state = connection.createStatement();
        return state;
    }

    public void close() throws Exception {
        connection.close();
    }
}
